package com.praveen.twu;

import com.praveen.twu.item.Book;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by praveen on 19/6/14.
 */
public class Biblioteca {

    public static String getWelcomeMessage() {
        return "Welcome to Biblioteca";
    }


    public static Menu getMenu() {
        Menu m = new Menu();
        m.addItem("List Books");
        m.addItem("Quit");
        return m;
    }

    public static void run() {
        System.out.println("------------------------------------");
        System.out.println(getWelcomeMessage());
        System.out.println("------------------------------------");
        Scanner in = new Scanner(System.in);
        Menu m = getMenu();
        while (true) {
            System.out.println("------------------------------------");
            System.out.println("\nPlease select an option");
            System.out.println(m.toString());
            System.out.println("------------------------------------\n");
            final int length = m.getItemCount();
            int inp = in.nextInt();
            if (inp == length)
                break;
            switch (inp) {
                case 1:
                    System.out.println("------------------------------------");
                    System.out.println(getBookList());
                    System.out.println("------------------------------------");
                    break;
                default:
                    System.out.println("Select a valid option!");
                    break;
            }
        }
    }
}
